package logic

import (
	"context"
	"furni-suite/furnirpc/furnirpc"
	"furni-suite/furnirpc/internal/svc"
	"furni-suite/models/mysql"
	"github.com/zeromicro/go-zero/core/logx"
)

type FurnitureShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewFurnitureShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FurnitureShowLogic {
	return &FurnitureShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 家具详情
func (l *FurnitureShowLogic) FurnitureShow(in *furnirpc.FurnitureShowRequest) (*furnirpc.FurnitureShowResponse, error) {
	// todo: add your logic here and delete this line

	var data *furnirpc.FurnitureShowResponse
	data = mysql.FurnitureShow(mysql.DB, in.FurnitureId)

	return &furnirpc.FurnitureShowResponse{
		FurnName:    data.FurnName,
		ClassName:   data.ClassName,
		BrandName:   data.BrandName,
		FurnitureId: data.FurnitureId,
	}, nil
}
